unit uBusMessage;

interface

type

  TBusMessage = record
    length: byte;
    data: array[0..255] of byte;

    procedure FromString(str: string);
    function  ToString: string;
  end;

implementation

{ TBusMessage }

procedure TBusMessage.FromString(str: string);
var
  i: byte;
begin
  length := system.length(str);
  for i := 1 to length do
    data[i-1] := ord( str[i] );
end;

function TBusMessage.ToString: string;
var
  i: byte;
begin
  result := '';

  for i := 0 to length-1 do
   result := result + chr(data[i]);
end;

end.
